/**
 * 解码
 * @param nums string字符串 数字串
 * @return int整型
 */
 function solve( nums ) {
  // write code here
  let dp = new Array(nums.length).fill(0)
  dp[0] = 1
  for(let i = 1;i < nums.length;i++){
    if(nums[i] === '0'){
      if(nums[i-1] === '1' || nums[i-1] === '2'){
        if(i === 1){
          dp[i] = 1
        }else{
          dp[i] = dp[i-2]
        }
      }
    }else if((nums[i-1] === '2' && nums[i] > '0' && nums[i] < '7') || (nums[i-1] === '1' && nums[i] > '0' && nums[i] <= '9')){
      if(i===1){
        dp[i] = 2
      }else{
        dp[i] = dp[i-1] + dp[i-2]
      }
    }else{
      dp[i] = dp[i-1]
    }
  }
  return dp[nums.length-1]
}
module.exports = {
  solve : solve
};